package com.time.sky.controller;

import com.time.sky.entity.Tinfo;
import com.time.sky.mapper.TinfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/Tinfo")
public class TinfoController {
    @Autowired
    private TinfoMapper tinfoMapper;
    @ResponseBody
    @RequestMapping("/select")
    public List<Tinfo> selectList(){   return tinfoMapper.selectList(); }
    @RequestMapping("/add")
    public void add(Tinfo tinfo){
        tinfoMapper.add(tinfo);
    }
    @RequestMapping("/delete/{tid}")
    public void delete(@PathVariable("tid") int tid){
        tinfoMapper.delete(tid);
    }
    @RequestMapping("/get/{tid}")
    public Tinfo getById(@PathVariable("tid") int tid){ return tinfoMapper.getById(tid); }
    @RequestMapping("/update")
    public void update(Tinfo tinfo){
        tinfoMapper.update(tinfo);
    }
    @ResponseBody
    @RequestMapping("/rows")
    public int rows(){
        return tinfoMapper.getRowCount();
    }
}
